<%@ Page Title="" Language="C#" MasterPageFile="~/Areas/Admin/Views/Shared/Admin.Master" Inherits="System.Web.Mvc.ViewPage<mesoBoard.Data.User>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
    <% if(false){ %>
    <script language="javascript" type="text/javascript" src="../../Content/jquery-1.3.2.min-vsdoc.js">
	</script>
	<%} %>
	
    <% UserProfile p = Model.UserProfile; %>  
    <script type="text/javascript" language="javascript">
        var selected = "selected";
        var notselected = "";
        var linkContainer = "#admin_tab_links";
        var linkChildren = "tab_link";
        var parentContainer = "#admin_tabs";
        var children = "tab";

        function showTab(tabid, item) {
            if ($("#" + tabid).is(":hidden")) {
                $(parentContainer).children().hide();
                $("#" + tabid).show();
                $("#tab_links_menu li").removeClass("selected");
                item.addClass("selected");
            }
        }
        $(function () {
            $("#userinfo").hide();
            showTab("userinfo", $("#tab_links_menu li.userinfo"));
            $("#tab_links_menu li").click(function () {
                //alert($(this).attr("id"));
                showTab($(this).attr("class"), $(this));
            });
            $("#tabs").tabs();

        });

    </script>
    
    <fieldset>
        <legend><%= Html.ThemeImage("user.png") %> User Details: <%= Model.Username %></legend>

        <div id="tabs">
	        <ul>
		        <li><a href="#accountinfo">Account Information</a></li>
		        <li><a href="#profile">Profile</a></li>
		        <li><a href="#roles">Roles</a></li>
	        </ul>
	        <div id="accountinfo">
                <dl class="details">
                    <dt>ID</dt>
                    <dd><%= Model.UserID %> <%= Html.AdminConfirm("(Delete User)", Url.Action("DeleteUser", new { UserID = Model.UserID}), Url.Action("UserDetails", new { UserID =  Model.UserID}))  %></dd>
                    
                    <dt>Username</dt>
                    <dd><%= Model.Username %></dd>

                    <dt>Email</dt>
                    <dd><%= Model.Email %></dd>

                    <dt>Status</dt>
                    <dd><%= string.IsNullOrEmpty(Model.ActivationCode) ? "<span class='active'>Active</span>" : "<span class='inactive'>Inactive</span>" %> <%= Html.ActionLink("(Change)", "ChangeUserStatus", new { UserID = Model.UserID })%></dd>

                    <dt>Joined</dt>
                    <dd><%= Model.RegisterDate %> from <%= Model.RegisterIP %></dd>

                    <dt>Last Login</dt>
                    <dd><%= Model.LastLoginDate %> from <%= Model.LastLoginIP %></dd>
                </dl>
	        </div>
	        <div id="profile">
                <dl class="details">
                    <dt>Avatar</dt>
                    <dd><%= Html.UserAvatar(Model.UserID) %></dd>
                    
                    <dt>Signature</dt>
                    <dd><%= Html.ParsePostText(p.Signature) %></dd>

                    <dt>Location</dt>
                    <dd><%= p.Location %></dd>

                    <dt>Birthdate</dt>
                    <dd><%= Model.UserProfile.Birthdate %></dd>

                    <dt>Always Show Signature</dt>
                    <dd><%= p.AlwaysShowSignature %></dd>
                </dl>
	        </div>
	        <div id="roles">
                <dl class="details">
                    <dt>Roles</dt>
                    <% foreach(var s in Model.InRoles){ %>    
                        <dd><%= Html.ImageLink("", Url.Action("RemoveFromRole", new { UserID = s.UserID, RoleID = s.RoleID}), Url.Content("~/Areas/Admin/Content/images/delete.png"), "Remove from role", "") %> | <%= s.Role.Name %></dd>
                    <%} %>
                </dl>
	        </div>
        </div>
        
    </fieldset>
    

</asp:Content>

